<template>
  <el-dialog
    title="编辑角色"
    :visible.sync="state"
    width="30%"
    :before-close="handleClose">
    <!-- dialog内容 -->
    <qf-form
      width="80px"
      :formConfig="formConfig"
      :formBtns="formBtns"
      @submit="submitFn">
    </qf-form>

    <!-- dialog内容 end -->
    <!-- <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary">确 定</el-button>
    </span> -->
  </el-dialog>
</template>

<script>
export default {
  props: {
    state: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      // 表单配置
      formConfig: [
        {
          label: '角色名',
          field: 'role_name',
          type: 'text',
          rules: [
            { required: true, message: '请输入角色名名', trigger: 'blur' }
            // { min: 3, max: 5, message: '用户名3-5个字符', trigger: 'blur' }
          ]
        },
        {
          label: '角色描述',
          field: 'role_desc',
          type: 'text',
          rules: [
            { required: true, message: '请输入角色描述', trigger: 'blur' }
            // { min: 3, max: 5, message: '用户名3-5个字符', trigger: 'blur' }
          ]
        }
      ],
      formBtns: [
        {
          content: '更新',
          type: 'primary'
        },
        {
          content: '重置',
          type: ''
        }
      ]
    };
  },

  methods: {
    handleClose() {
      this.$emit('close');
    },
    submitFn(formData) {
      console.log('更新数据处理', formData);
    }
  }
};
</script>

<style></style>
